//package com.example.demo.service.impl;
//
//import com.example.demo.dao.UserDao;
//import com.example.demo.entity.User;
//import com.example.demo.service.UserService;
//import lombok.extern.slf4j.Slf4j;
////import org.springframework.data.domain.Page;
////import org.springframework.data.domain.PageRequest;
////import org.springframework.data.domain.Pageable;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Collections;
//import java.util.List;
//import java.util.Optional;
//
//@Slf4j
//@Service
//public class UserServiceImpl implements UserService {
//
////    @Resource
////    private UserDao userDao;
////    @Override
////    public Long save(User user) {
////        userDao.save(user);
////        return user.getId();
////    }
////    @Override
////    public User getById(Long id) {
////        Optional<User> find = userDao.findById(id);
////        if (find.isPresent()) {
////            return find.get();
////        }
////        return null;
////    }
////    @Override
////    public void deleteById(Long id) {
////        userDao.deleteById(id);
////    }
////    @Override
////    public List<User> getAll() {
////        Iterable<User> users = userDao.findAll();
////        if (users == null) {
////            return Collections.emptyList();
////        }
////        List<User> userList = new ArrayList<User>();
////        users.forEach(o -> userList.add(o));
////        return userList;
////    }
////    @Override
////    public List<User> getListByName(String name) {
////        return userDao.findByName(name);
////    }
////    @Override
////    public List<User> getListByNameAndAge(String name, Integer age) {
////        return userDao.findByNameAndAge(name, age);
////    }
////    @Override
////    public List<User> getListOrderByAgeDesc() {
////        return userDao.findByOrderByAgeDesc();
////    }
////    @Override
////    public Page<User> getPage(int pageNum, int pageSize) {
////        // 注意，这里的pageNum是从0开始的，如果要查询第1页数据，pageNum应该为0
////        Pageable pageable = PageRequest.of(pageNum, pageSize);
////        log.info("getPage--->{},{}",pageNum,pageSize);
////        return userDao.findAll(pageable);
////    }
//}
